<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<script>
  const obj = { name: 'allen' };

  Function.prototype.myBind = function (context, ...args) {
    const ctx = context || window;

    if (typeof this !== 'function') {
      throw new TypeError('not function');
    }

    ctx.fn = this;

    return function Fn(...args1) {
      return ctx.fn(...args, ...args1);
    };
  };

  function say(param1, param2) {
    console.log(param1, param2, this.name);
  }

  const fn = say.myBind(obj, 'man', 27);
  // console.log(new fn());
  fn();
</script>
</body>
</html>
